/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package etherblocks.mods.shooter.entitysystem.systems;

import etherblocks.game.entitysystem.*;
import etherblocks.game.entitysystem.components.*;
import etherblocks.mods.shooter.entitysystem.components.*;

/**
 *
 * @author Carl
 */
public class CheckHealthSystem implements EntitySystem{
    
    @Override
    public void onNextFrameCalculation(EntityMap entityMap, float lastTimePerFrame){
        for(Entity entity : entityMap.getEntities(HealthComponent.class)){
            HealthComponent healthComponent = entity.getComponent(HealthComponent.class);
            if(healthComponent.getHealth() <= 0){
                entity.setComponent(new RemoveRequestComponent());
            }
        }
    }
}
